home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / SLAX 6.0.8 / slax-6.0.8.iso / slax / base / 006-devel.lzm / usr / include / krecentdocument.h < prev    next >
Encoding:
C/C++ Source or Header  |  2005-09-10  |  3.7 KB  |  106 lines

  1. /* -*- c++ -*-
  2.  * Copyright (C)2000 Daniel M. Duley <mosfet@kde.org>
  3.  *
  4.  * All rights reserved.
  5.  *
  6.  * Redistribution and use in source and binary forms, with or without
  7.  * modification, are permitted provided that the following conditions
  8.  * are met:
  9.  * 1. Redistributions of source code must retain the above copyright
  10.  *    notice, this list of conditions and the following disclaimer.
  11.  * 2. Redistributions in binary form must reproduce the above copyright
  12.  *    notice, this list of conditions and the following disclaimer in the
  13.  *    documentation and/or other materials provided with the distribution.
  14.  *
  15.  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
  16.  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  17.  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  18.  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
  19.  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  20.  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  21.  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  22.  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  23.  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  24.  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  25.  * SUCH DAMAGE.
  26.  *
  27.  */
  28. #ifndef __KRECENTDOCUMENT_H
  29. #define __KRECENTDOCUMENT_H
  30.  
  31. #include <qstring.h>
  32. #include <kurl.h>
  33.  
  34. /**
  35.  * Manage the "Recent Document Menu" entries displayed by
  36.  * applications such as Kicker and Konqueror.
  37.  *
  38.  * These entries are automatically generated .desktop files pointing
  39.  * to the current application and document.  You should call the
  40.  * static add() method whenever the user opens or saves a new
  41.  * document if you want it to show up in the menu.
  42.  *
  43.  * You don't have to worry about this if you are using any
  44.  * KFileDialog derived class to open and save documents, as it
  45.  * already calls this class.  User defined limits on the maximum
  46.  * number of documents to save, etc... are all automatically handled.
  47.  *
  48.  * @author Daniel M. Duley <mosfet@kde.org>
  49.  */
  50. class KIO_EXPORT KRecentDocument
  51. {
  52. public:
  53.  
  54.     /**
  55.      *
  56.      * Return a list of absolute paths to recent document .desktop files,
  57.      * sorted by date.
  58.      *
  59.      */
  60.     static QStringList recentDocuments();
  61.  
  62.     /**
  63.      * Add a new item to the Recent Document menu.
  64.      *
  65.      * @param url The url to add.
  66.      */
  67.     static void add(const KURL& url);
  68.  
  69.     /**
  70.      * Add a new item to the Recent Document menu, specifying the application to open it with.
  71.      * The above add() method uses argv[0] for the app name, which isn't always flexible enough.
  72.      * This method is used when an application launches another one to open a document.
  73.      *
  74.      * @param url The url to add.
  75.      * @param desktopEntryName The desktopEntryName of the service to use for opening this document.
  76.      */
  77.     static void add(const KURL& url, const QString& desktopEntryName);
  78.  
  79.     /**
  80.      *
  81.      * Add a new item to the Recent Document menu. Calls add( url ).
  82.      *
  83.      * @param documentStr The full path to the document or URL to add.
  84.      * @param isURL Set to @p true if @p documentStr is an URL and not a local file path.
  85.      */
  86.     static void add(const QString &documentStr, bool isURL = false);
  87.  
  88.     /**
  89.      * Clear the recent document menu of all entries.
  90.      */
  91.     static void clear();
  92.  
  93.     /**
  94.      * Returns the maximum amount of recent document entries allowed.
  95.      */
  96.     static int maximumItems();
  97.  
  98.     /**
  99.      * Returns the path to the directory where recent document .desktop files
  100.      * are stored.
  101.      */
  102.     static QString recentDocumentDirectory();
  103. };
  104.  
  105. #endif
  106.